<?php

class Corner_content_Model extends ORM

{

	protected $table_name = 'corner_content';

	protected $primary_key = 'corner_content_id'; 

	protected $col_corner_id = 'corner_id';

	protected $col_language_id = 'languages_id';

	protected $sorting = array('corner_content_id' => 'desc');

	

	public function get($corner_id='',$language_id='')

	{

		$this->db->select('*');

		$this->db->from($this->table_name);		

		$this->db->orderby($this->primary_key,'desc');

		if($corner_id) $this->db->where($this->col_corner_id,$corner_id);

		if($language_id) $this->db->where($this->col_language_id,$language_id);

		$query = $this->db->get();

		return $query->result_array(false);

		

	}

	

	public function get_corner()

	{

		$this->db->select('*');

		$this->db->from('corner');

		$this->db->join('corner_content','corner.corner_id','corner_content.corner_id');

		$this->db->where('corner_status',1);

		$this->db->orderby('corner_sort_order','desc');	

		$this->db->orderby($this->primary_key,'desc');	

		$query = $this->db->get();

		return $query->result_array(false);

	}

}